﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using GameEngine.Worlds;
using GameEngineSL.SilverlightCompatibility;

namespace WebGuiSL
{
    public class Renderer
    {
        private Canvas drawingCanvas;

        public Renderer(Canvas canvas)
        {
            //Add the Path Element
            Path myPath = new Path();
            myPath.StrokeThickness = 4;

            EllipseGeometry myEllipseGeometry = new EllipseGeometry();
            myEllipseGeometry.Center = new System.Windows.Point(50, 50);
            myEllipseGeometry.RadiusX = 25;
            myEllipseGeometry.RadiusY = 25;
            myPath.Data = myEllipseGeometry;
            myPath.Stroke = new SolidColorBrush(Colors.Red);

            drawingCanvas = canvas;
            canvas.Children.Add(myPath);
        }

        public void Render(World world)
        {
            Path myPath = (Path)drawingCanvas.Children[1];
            EllipseGeometry circle = (EllipseGeometry)myPath.Data;
            PointF position = world.Units[0].Position;
            circle.Center = new Point(position.X, position.Y);
        }
    }
}
